local cuidi = fk.CreateSkill{
  name = "sd__cuidi",
  tags = { Skill.Compulsory }
}

cuidi:addEffect(fk.TargetSpecified, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(cuidi.name) and data.card and data.card.trueName == "slash" and
    not data.to:isWounded()
  end,
  on_use = function(self, event, target, player, data)
    data:setDisresponsive(data.to)
  end,
})

cuidi:addEffect(fk.CardUsing, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(cuidi.name) and data.card and data.card.trueName == "slash" and not data.extraUse
  end,
  on_use = function(self, event, target, player, data)
    -- 检查是否所有目标都未受伤，如果是则减少使用次数记录
    local allUnwounded = true
    for _, to in ipairs(data.tos) do
      if to:isWounded() then
        allUnwounded = false
        break
      end
    end
    if allUnwounded then
      player:addCardUseHistory("slash", -1)
    end
  end,
})

cuidi:addEffect(fk.DamageCaused, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(cuidi.name) and
      data.card and data.card.trueName == "slash" and data.to and data.to.hp <= 1
  end,
  on_use = function(self, event, target, player, data)
    data:changeDamage(1)
  end,
})

Fk:loadTranslationTable{
  ["sd__cuidi"] = "摧敌",
  [":sd__cuidi"] = "锁定技，当你使用【杀】指定目标后，若目标角色未受伤，其不能使用【闪】响应此【杀】且此【杀】不计入次数限制；当你使用【杀】对一名体力值不大于1的角色造成伤害时，此伤害+1。",
  
  -- 语音台词
  ["$cuidi1"] = "摧枯拉朽，势不可挡！",
  ["$cuidi2"] = "敌势已衰，乘胜追击！",
}

return cuidi